from typing import List


class Solution:
    def minMovesToSeat(self, seats: List[int], students: List[int]) -> int:
        seats.sort()
        students.sort()
        sum = 0
        for i in range(len(seats)):
            sum += abs(students[i] - seats[i])
        return sum
# 升级版
    def minMovesToSeat1(self, seats: List[int], students: List[int]) -> int:
        seats.sort()
        students.sort()
        out_list = [abs(x-y) for x,y in zip(seats,students)]

        return sum(out_list)


if __name__ == '__main__':
    seats = [12,14,19,19,12]
    students = [19,2,17,20,7]
    solution = Solution()
    val = solution.minMovesToSeat1(seats,students)
    print(val)
